home *** CD-ROM | disk | FTP | other *** search
- THE OBJECT MODULE, INCLUDE FILE AND DOCUMENTATION IN THIS ARCHIVE ARE EXPRESSLY
- NOT BEING PLACED IN THE PUBLIC DOMAIN. You may utilize the object module in
- modified or unmodified form in your own programs without restriction. You may
- distribute unmodified copies of the original archive which includes the files:
-
- Editor.obj
- Editor.doc (this file)
- Editor.bi
-
- (c) 1989 Christopher P. Rouse
-
- OVERVIEW
-
- Editor uses essentially the same key combinations as the QuickBASIC program
- editor. The only real difference is that, since Editor is designed to be used
- with single line entry fields in a data base environment, it does not support
- the vertical cursor movement functions such as the up and down arrows, page up
- or down, etc. The following table lists the editing keys that are supported:
-
- Key Action
-
- Left Arrow Move the cursor one character left
- Right Arrow Move the cursor one character right
- Ctrl-Left Arrow Move the cursor one word left
- Ctrl-Right Arrow Move the cursor one word right
-
- Ctrl-A Move the cursor one word left
- Ctrl-S Move the cursor one character left
- Ctrl-D Move the cursor one character right
- Ctrl-F Move the cursor one word right
-
- Ctrl-H Delete the character to the left
- Backspace Delete the character to the left
- Ctrl-T Delete the word at the cursor
- Ctrl-Y Delete the entire line
-
- Ins Toggle insert mode
-
- Editor makes no distinction between the dedicated cursor movement keys available
- on the enhanced keyboards and the traditional keys on the numeric keypad.
-
- Editor uses the keyboard status byte at 0040:0017h to track the insert status.
- Setting bit 7 will cause the insert state to be active. This is consistent
- with DOS and BIOS. At this time, no change is made in cursor size to indicate
- the current status.
-
- Editor writes directly to the display adapter and is NOT synchronized with the
- vertical retrace. This will cause "snow" with some CGA adapters. While
- noticable, the duration of the snow is so brief that I didn't feel the benefit
- of eliminating the snow outweighed the increase in program size that would be
- required to determine display adapter type and synchronize the display write.
- If you encounter a situation that causes unacceptable "snowing", please let me
- know. (Include system processor, adapter type and brand, and size of the field
- that Editor was editing.)
-
- Editor is designed for use with text modes only. It has been tested with 40
- and 80 column screen modes. It should work with other screen widths (up to 255
- columns) but this has not been verified. Using Editor in graphics modes will
- cause unpredictable results (a euphamism for "it definitely won't work and
- might hang the system").
-
- Editor uses BIOS calls to accept input from the keyboard, therefore redirection
- of STDIN will not function.
-
- Editor supports "windowed" editing. A field to be edited may be longer than
- what is displayed. Editor will scroll the field horizontally to accomodate the
- additional length.
-
- While not really designed for it, there is nothing in Editor that precludes
- its' use on multi-line fields. Long edit fields will aggravate "snow" problems
- on some CGA adapter/monitor combinations.
-
- USAGE WITH QuickBASIC
-
- Function and Subroutine Declaratons:
-
- DECLARE FUNCTION EditString% (Text$, BYVAL Row%, BYVAL Column%, BYVAL Colour%)
- DECLARE FUNCTION EditWindow% (BYVAL WindowLen%, Text$, BYVAL Row%, BYVAL Column%, BYVAL Colour%)
- DECLARE SUB EdRetCodes (BYVAL ArraySeg%, BYVAL ArrayOffs%, BYVAL SizeOfArray%)
- DECLARE SUB PushKey (BYVAL Key2Push%)
-
- EditString and EditWindow:
-
- Text$ is the "default" or pre-existing text string to be edited
- Row% is the display row that the text is to be edited on
- Column% is the column postion of the text string
- Colour% is the color to use on the display (see "Attributes")
- WindowLen% is the length of the display window
-
- EditString and EditWindow are functionally identical except that EditWindow
- limits the number of characters that are displayed and performs horizontal
- scrolling. Throughout this documentation the term Editor will refer to both
- EditString and EditWindow.
-
- In order to display the cursor, a LOCATE , , 1 must have been executed prior to
- calling Editor. When Editor is called, it first displays Text$ at Row%,
- Column% using the color specified by Colour%. Then the user may modify Text$
- using the editing keys previously mentioned. Editor locates the QB cursor at
- Row%, Column% prior to returning. This facilitates highlighting the active
- field:
-
- DECLARE FUNCTION EditField%(Text$, BYVAL Row%, BYVAL Column%, Colour%)
- COLOR 7, 0
- CLS
- Text$ = "Hello, World"
- ReturnKey% = EditField(Text$, 10, 35, &H70)
- PRINT Text$
-
- will display "Hello, World" in reverse video, allow the user to change the
- contents of Text$, and then display Text$ in normal video. Editor ALWAYS
- returns when Enter, Tab, Shift-Tab or Esc is pressed. Editor returns the ASCII
- value and scan code of the key that caused the return:
-
- Key Value Returned
-
- Enter &H1C0D
- Tab &HF09
- Shift-Tab &HF00
- Esc &H11B
-
- ANDing the returned value with &HFF will isolate the ASCII portion, dividing
- it by &H100 will isolate the keyboard scan code.
-
-
- EdRetCodes:
-
- DECLARE SUB EdRetCodes (BYVAL ArraySeg%, BYVAL ArrayOffs%, BYVAL SizeOfArray%)
-
- ArraySeg% is the value returned by VARSEG(Array%(?))
- ArrayOffs% is the value returned by VARPTR(Array%(?))
- SizeOfArray% is the number of elements in Array%
-
- EdRetCodes allows you to define other Scan Code - ASCII Code combinations which
- will cause Editor to return. An arbitrary limit of 100 additional return codes
- has been placed on Editor. Passing a value of SizeOfArray% greater than 100
- will cause unpredictable results (probably hang the system) during subsequent
- calls to Editor. The values of the elements of the array should be valid
- values returned by BIOS call 16h, function 0. Invalid values are ignored.
- Editor checks to see if a keypress should return before it checks to see if it
- is a "special" key, therefore you may make any of the "special" keys (Ctrl-Y,
- for instance) generate a return instead of taking the normal action (clear the
- line).
-
- Editor ignores the status of the Caps Lock, Num Lock and Shift keys when
- determining whether or not to return. This means that Alt-F and Alt-f are
- identical to Editor. Editor does not require you to define the same key many
- times in the way that user defined keys in QB do. This allows you to "poll"
- the keyboard input in lieu of event trapping. This can significantly decrease
- program size and increase execution speed in addition to eliminating some of
- the potential problems caused by event trapping in multi-module programs and
- libraries.
-
- Passing a value of 0 for SizeOfArray% will cancel assignments made by a prior
- call to EdRetCodes.
-
-
- PushKey:
-
- DECLARE SUB PushKey (BYVAL Key2Push%)
-
- PushKey was written to provide a way for a trapped event to force a return from
- Editor. Key2Push% uses the same Scan Code - ASCII Code values that Editor
- returns. It could also be used to provide a small macro capability to a
- program. PushKey may be called up to 15 times before a key must be read using
- INKEY$, INPUT$, INPUT or LINE INPUT. The 16th call to PushKey effectively
- cancels the first 15.
-
- WARNING: PushKey has only been tested on a limited basis. It has never hung a
- system but does not function correctly in conjunction with a SLEEP statement.
-
-
- Attributes:
-
- Editor uses color attributes in the same way they are used in assembler. The
- upper "nibble" of the attribute byte defines the background color, the lower
- nibble defines the foreground color. It may be calculated from the BASIC way
- of defining screen colors by:
-
- AsmColor = BasBG * &H10 + BasFG
-
- where
-
- AsmColor is the value to be passed to Editor.
- BasBG is the background color
- BasFG is the foreground color
-
-
- Memory Requirements and Distribution:
-
- The Editor module will use approximately 1600 bytes of memory. It requires
- roughly 220 bytes of static data space (200 bytes of which is for defining
- "return" keys). All of this static data space has been placed in Edit_Text
- segment (code) to preserve as much as possible of the rapidly shrinking DGROUP.
-
-
- Comments, suggestions and constructive criticism are always appreciated.
-
- Christopher P. Rouse
- 4684 N. 86 St.
- Milwaukee, WI 53225
-
- (414) 535-1981
- CIS 71420, 614
-
-
-
- ----------------end-of-author's-documentation---------------
-
- Software Library Information:
-
- This disk copy provided as a service of
-
- The Public (Software) Library
-
- We are not the authors of this program, nor are we associated
- with the author in any way other than as a distributor of the
- program in accordance with the author's terms of distribution.
-
- Please direct shareware payments and specific questions about
- this program to the author of the program, whose name appears
- elsewhere in this documentation. If you have trouble getting
- in touch with the author, we will do whatever we can to help
- you with your questions. All programs have been tested and do
- run. To report problems, please use the form that is in the
- file PROBLEM.DOC on many of our disks or in other written for-
- mat with screen printouts, if possible. The P(s)L cannot de-
- bug programs over the telephone.
-
- Disks in the P(s)L are updated monthly, so if you did not get
- this disk directly from the P(s)L, you should be aware that
- the files in this set may no longer be the current versions.
-
- For a copy of the latest monthly software library newsletter
- and a list of the 1,800+ disks in the library, call or write
-
- The Public (Software) Library
- P.O.Box 35705 - F
- Houston, TX 77235-5705
- (713) 665-7017
-